package net.csdn.business.common.domain.request;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author wanghang
 * @version 1.0
 * @date 2022/11/15 17:24
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LabelSearchDto implements Serializable {

    private String key;

    @Getter
    @AllArgsConstructor
    public enum SortEnum {
        LABEL_NAME_DESC,
        LABEL_NAME_ASC,
        CREATED_DATE_DESC,
        CREATED_DATE_ASC;

        public static SortEnum ofCode(String sortField) {
            try {
                return SortEnum.valueOf(sortField);
            } catch (Exception e) {
                return SortEnum.CREATED_DATE_DESC;
            }
        }
    }

}